<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>邮寄地址管理</title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <link href="css/style_1.css" rel="stylesheet" type="text/css" />
    <style>
        a {
            color: inherit;
        }
    </style>
</head>

<body>

    <section class="aui-flexView">
        <header class="aui-navBar aui-navBar-fixed b-line">
            <a href="javascript:;" class="aui-navBar-item">
                <i class="icon icon-return"></i>
            </a>
            <div class="aui-center">
                <span class="aui-center-title">邮寄地址管理</span>
            </div>
            <a href="javascript:;" class="aui-navBar-item">
                <i class="icon icon-sys"></i>
            </a>
        </header>
        <section class="aui-scrollView">
            <div class="divHeight b-line"></div>
            <div class="aui-address-box b-line">
                <div class="aui-address-add b-line">
                    <a href="/add_address">+添加</a>
                </div>
                {{each data item}}
                <div class="aui-flex b-line" data-id="{{item.id}}">
                    <div class="aui-address-edit" data-id="{{item.id}}">编辑</div>
                    <div class="aui-flex-box">
                        <h3>{{item.cons}} {{item.constel}}</h3>
                        <p>{{item.city}} {{item.dele}} </p>
                        <p>{{item.email}}</p>
                    </div>
                    <div class="delel" style="color: red; line-height: 3rem; cursor: pointer;" data-id="{{item.id}}">删除
                    </div>
                </div>
                {{/each}}
            </div>
        </section>
    </section>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
    <script>
        $('.delel').click(function () {
            $.get('delel', { id: $(this).data('id') }, data => {
                alert(data)
                location.reload()
            })
        })
        $('.aui-address-edit').click(function () {
            location.href = '/add_address?id=' + $(this).data('id')
        })
        $('.aui-navBar-item').click(function () {
            history.back()
        })
        $('.aui-flex').click(function () {
            if (location.href.includes('id')) {
                location.href = '/order?id=' + $(this).data('id')
            }
            $.cookie('address', 1)
        })
        if (!$.cookie('user')) {
            alert('请先登录')
            location.href = '/member'
        }
    </script>
</body>

</html>